import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author: WangYongGan
 * @Date: 2021/11/18 19:49
 * @Description:
 */
public class 多次匹配 {
    public static void main(String[] args) {
        Matcher matcher = Pattern.compile("(a)").matcher("abaaaa");
        int matcher_start = 0;
        while (matcher.find(matcher_start)){
            String group = matcher.group(1);
            System.out.println(matcher.group(1));
            matcher_start = matcher.end();
        }
    }
}
